<template>
	<div>
		<!-- xpert导航栏 -->
		<xpertNavBar :statusTab="statusTab" />
		<div style="height: 150px; width: 100%"></div>
		<!-- My list -->
		<div class="list m1280">My list</div>
		<!-- btn -->
		<div class="btn m1280 f f-a-c f-j-b">
			<div class="lefBtn f f-a-c">
				<div :class="{ act: num == 1 }" @click="qieNum(1)" class="exp hand">Club</div>
				<div :class="{ act: num == 2 }" @click="qieNum(2)" class="inter hand">Articles</div>
			</div>
			<div @click="newList" class="rigBtn hand">+ Create a new list</div>
		</div>
		<!-- You have 4 lists saved. -->
		<div class="saved m1280">You have 4 lists saved.</div>
		<!-- Business  -->
		<div v-if="num == 1">
			<div v-for="(item, index) in 4" :key="index" class="business f f-a-c f-j-b m1280">
				<div class="leftNmae">
					<div class="bus">Business</div>
					<div class="people">3 people <span>Updated Aug/15/2023</span></div>
				</div>
				<div class="leftAvart f f-a-c">
					<!-- <div class="imgList">
						<img src="/src/assets/tou.png" class="imgTouImg" alt="" />
						<img src="/src/assets/tou.png" class="imgTouImg" alt="" />
						<img src="/src/assets/tou.png" class="imgTouImg" alt="" />
					</div> -->
					<div @click="goView" class="view hand">View</div>
					<img @click="goView" src="/src/assets/user/back2.png" class="back2 hand" alt="" />
				</div>
			</div>
		</div>
		<div class="" v-else>
			<div v-for="(item, index) in 4" :key="index" class="business f f-a-c f-j-b m1280">
				<div class="leftNmae">
					<div class="bus">Business</div>
					<div class="people">3 people <span>Updated Aug/15/2023</span></div>
				</div>
				<div class="leftAvart f f-a-c">
					<div @click="goViewBusiness" class="view hand">View</div>
					<img @click="goViewBusiness" src="/src/assets/user/back2.png" class="back2 hand" alt="" />
				</div>
			</div>
		</div>
		<div style="height: 70px"></div>
		<!-- 添加 -->
		<el-dialog v-model="listVisible" title="" width="540">
			<div class="dialogTitle">Create a new favorite</div>
			<div class="inpSet f f-a-c">
				<div @click="ind = 1" class="hand lef f f-a-c">
					<img v-if="ind == 1" src="/src/assets/user/gou.png" alt="" />
					<img v-else src="/src/assets/user/weigou.png" alt="" />
					Club
				</div>
				<div @click="ind = 2" class="hand lef f f-a-c">
					<img v-if="ind == 2" src="/src/assets/user/gou.png" alt="" />
					<img v-else src="/src/assets/user/weigou.png" alt="" />
					Articles
				</div>
			</div>
			<div class="nameDia">List name</div>
			<input type="text" v-model="listValue" class="dialogInp" name="" id="" />
			<div class="diolBtn f f-a-c">
				<div class="add hand">Add</div>
			</div>
		</el-dialog>
		<xpertTabbar />
	</div>
</template>

<script setup>
	import { ref, onMounted } from "vue";
	import xpertTabbar from "@/components/tabBar/xpertTabbar.vue";
	import xpertNavBar from "@/components/navBar/xpertNavBar.vue";
	import router from "@/router/index.js";
	import ButtonDiffuse from "@/components/Button/ButtonDiffuse.vue";
	let statusTab = ref(1);
	let num = ref(1);
	let ind = ref(1);
	let listValue = ref("");
	let listVisible = ref(false);
	onMounted(() => {
		window.addEventListener("scroll", handleScroll);
	});
	// 切换
	const qieNum = item => {
		num.value = item;
	};
	// 点击添加列表
	const newList = () => {
		listVisible.value = true;
	};
	// 去view
	const goView = () => {
		router.push({
			path: "/BuyClubView"
		});
	};
	// 去view
	const goViewBusiness = () => {
		router.push({
			path: "/BuyArticlesView"
		});
	};
	// 这个是当头部导航栏滑倒下面时给tabr加个背景
	const handleScroll = () => {
		const scrollTop = document.documentElement.scrollTop;
		if (scrollTop > 0) {
			statusTab.value = 2;
		} else {
			statusTab.value = 1;
		}
	};
</script>
<style scoped>
	@import "./index.scss";
</style>
